package com.peanut.bosskg.service.other.enterprise;

import com.alibaba.fastjson.JSON;
import com.peanut.bosskg.entity.ResponseMessageVO;
import com.peanut.bosskg.entity.enterprise.OpenEnterpriseReqDTO;
import com.peanut.bosskg.entity.enterprise.OpenEnterpriseResDTO;
import com.peanut.bosskg.enums.FunCodeEnum;
import com.peanut.bosskg.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class OpenEnterpriseService extends BaseService {

    /**
     * @param funCodeEnum
     * @param reqDTO
     * @return
     * @throws Exception
     */
    public OpenEnterpriseResDTO doBusiness(FunCodeEnum funCodeEnum, OpenEnterpriseReqDTO reqDTO) throws Exception {
        log.info("开户接口开始:{}，{}", funCodeEnum, reqDTO);
        ResponseMessageVO responseMessage = applyYouFuByHttpPost(funCodeEnum, reqDTO);
        OpenEnterpriseResDTO resDTO = JSON.parseObject(responseMessage.getResData(), OpenEnterpriseResDTO.class);
        log.info("开户接口结束:{}", resDTO);
        return resDTO;
    }
}
